package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
 * @Author 王加鑫
 * @Date 2021/7/22 22:38
 * @Since JDK 1.9
 */
@Repository
public interface UserDao {

    @Select("insert into user values(null,#{uname},#{upassword})")
    public void save(User user);

    @Update("update user set uname = #{uname},upassword = #{upassword} where uid = #{uid}")
    public void update(User user);

    @Delete("delete from user where uid = #{uid}")
    public void delete(Integer id);

    @Select("select * from user where id = #{id}")
    public User findById(Integer id);

    @Select("select * from user")
    public List<User> findAll();
}
